import Vue from 'vue'
import VueResource from 'vue-resource'
import App from './App'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import router from './router'
import Less from 'less'


Vue.config.productionTip = false
Vue.use(ElementUI);
Vue.use(VueResource);
Vue.use(Less);

router.beforeEach(function (to, from, next) {
  let loginState = window.sessionStorage.getItem("loginState");
  if (loginState === null || !loginState) {
    //未登录
    window.sessionStorage.setItem("loginState", false);
    next({path: "/"});
  } else {
    next();
  }
});

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: {App},
  template: '<App/>'
})
